import request from "@/lib/utils/request";
import { PaginationType, Response } from "../common";
import type { Menu } from "./menu.d";

export const getMenuListApi = (params: PaginationType): Response<Menu[]> => {
  return request.get("/system/menu/list", { params });
};

export const deleteMenuApi = (id: string): Response<null> => {
  return request.delete(`/system/menu/${id}`);
};

export const getMenuApi = (id: string): Response<Menu> => {
  return request.get(`/system/menu/${id}`);
};

export const updateMenuApi = (data: Menu): Response<null> => {
  return request.put("/system/menu", data);
};

export const addMenuApi = (data: Menu): Response<null> => {
  return request.post("/system/menu", data);
};

export const getMenuTreeApi = (): Response<Menu[]> => {
  return request.get("/system/menu/treeselect");
};
